package com.family.gmall.web.controller;

import com.family.gmall.common.result.Result;
import com.family.gmall.item.client.ItemFeignClient;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.annotation.Resource;
import java.util.Map;

/**
 * @Auther: family
 * @Date: 2023/7/14 10:45
 * @Description:
 */
@Controller
public class ItemController {
    @Resource
    private ItemFeignClient itemFeignClient;


    @RequestMapping("/{skuId}.html")
    public String getItem(@PathVariable Long skuId, Model model) {
        Result<Map> result = itemFeignClient.getItem(skuId);
        model.addAllAttributes(result.getData());
        return "item/index";
    }
}
